
;(function($) {

  var methods = {
		  
    init: function(settings) {
    	
    	 var that  = $(this);
    	 var opt = $.extend(true, {}, $.fn.layerTip.defaults, settings);
    	 $(document).on("mouseenter", opt.tipEle, function() {
          	var title = $(this).data("tip");
          	if(!title || title === undefined){
          		return ;
          	}
          	Index = layer.tips(title,this,{
          		  tips: [opt.position, opt.bgColor],
          		  time: opt.time
          		}); 
    	 });
	     $(document).on("mouseleave", opt.tipEle, function() {
	    	layer.closeAll('tips');
	     });
    },
  };

  $.fn.layerTip = function(method) {
    if (methods[method]) {
      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method) {
      return methods.init.apply(this, arguments);
    } else {
      $.error('Method ' + method + ' does not exist!');
    }
  };

  $.fn.layerTip.defaults = {
     time:40000000,
     position:1,
     bgColor:'#3595CC',
     tipEle  : ".icon-wh",//tip ele choose
     errorMsg : "æç¤ºåå®¹ä¸ºç©ºï¼ãè¯·å¨ç¸åºåç´ ä¸é¢å å¥data-tip='æç¤ºåå®¹'ã",
  };

  $(document).layerTip();
  
})(jQuery);
